package ltaa.sponsoredsearch.GAM;

import java.util.Map;
import java.util.HashMap;
import java.util.Set;
import java.util.HashSet;
import java.util.Iterator;

class Outcome {
	public Map<Bidder, Set<Integer>> attribution;
	public Map<Bidder, Double> payments;

	public Outcome() {
		attribution = new HashMap<Bidder, Set<Integer>>();
		payments = new HashMap<Bidder, Double>();
	}

	public String toString() {
		Iterator it = payments.keySet().iterator();

		String ret = "";

		while (it.hasNext()) {
			Bidder key = (Bidder) it.next();

			ret+="Bidder "+key.getID()+" gets ";

			if (attribution.containsKey(key) && attribution.get(key).size() > 1) {
				ret += "items " + attribution.get(key) + " ";
			} else if(attribution.containsKey(key) && attribution.get(key).size() > 0) {
				ret += "item " + attribution.get(key) + " ";
			} else {
				ret += "no items ";
			}

			ret += "at price "+payments.get(key)+".\n";
		}
		return ret;
	}
}
